<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="./css/login.css">
        <link rel="shortcut icon"  href="image/icon6.ico" type="image/x-icon" /> 
        <script src="./script/jquery.js" type="text/javascript"></script>
        <title>Login</title>
    </head>
    <body>
        <form  class="login"  enctype="text/plain" >
            <p>Admin</p>
            <input id="account"  type="text" placeholder="用户名">
            <input id="password" type="password" placeholder="密码">
            <button id="loginbutton" class="btn" >登录</button>
        </form>
        <script>
            $("#loginbutton").click(
                    function () {
                        $.get("./Servlet/loginServlet?account=" + $("#account").val() + "&password=" + $("#password").val(), function (data, status) {
                            if (status) {
                                if (data.toString().trim() === "true")
                                {
                                    window.location.href = "manage.jsp";
                                } else {
                                    alert("账号密码错误");
                                }
                            } else {
                                alert("无法连接服务器");
                            }
                        }
                        );
                    }
            );
        </script>
    </body>
</html>

